<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
	<META HTTP-EQUIV="Expires" CONTENT="-1">	
</head>			


	<script src="js/cropper/lib/prototype.js" type="text/javascript"></script>
 	<script src="js/cropper/lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
	<script src="js/cropper/cropper.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/simwebDesign.js"></script>


	<script type="text/javascript" >

		function onEndCrop( coords, dimensions ) {
			$( 'x1' ).value = coords.x1;
			$( 'y1' ).value = coords.y1;
			$( 'x2' ).value = coords.x2;
			$( 'y2' ).value = coords.y2;
			$( 'width' ).value = dimensions.width;
			$( 'height' ).value = dimensions.height;
		}

		// example with a preview of crop results, must have minimumm dimensions
		Event.observe(
			window,
			'load',
			function() {
				new Cropper.ImgWithPreview(
					'testImage',
					{
						minWidth: 80,
						minHeight:80,
						ratioDim: { x: 0, y: 0 },
						displayOnInit: true,
						onEndCrop: onEndCrop,
						onloadCoords: {x1:1, y1:1, x2:10, y2:11},
						previewWrap: 'previewArea'
					}
				)
			}
		);

		/*
		if( typeof(dump) != 'function' ) {
			Debug.init(true, '/');

			function dump( msg ) {
				// Debug.raise( msg );
			};
		} else dump( '---------------------------------------\n' );
		*/

	</script>
	<link rel="stylesheet" type="text/css" href="debug.css" media="all" />
	<style type="text/css">
		label {
			clear: left;
			margin-left: 50px;
			float: left;
			width: 5em;
		}

		#testWrap {
			width: 500px;
			/*float: left;*/
			position:relative;
			left:0px;
			top:0px;
			margin: 20px 0 0 10px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
		}

		#previewArea {
			margin: 10px; 0 0 0px;
			/*float: left;*/
			position:relative;
			left:10px;
		}

		#results {
			clear: both;
		}
		
		.hand{cursor: pointer;}
		.mT4{margin-top:3px;}
		.right{float: right;}
		.barraCinza{
			margin-left:5px;
			margin-right:5px;
			margin-top:4px;
			margin-bottom:4px;
			width:100%-30px;
			display: block;
			height:30px;
			line-height:30px;
			background-color: #cccccc;
			
		}
		.clear{clear: both;}
		.minwidth7{
			width:645px;
			line-height: 0px;
			float: left;
			display:block;
		}
		
	</style>
</head>
<body style="background-color: #EFEFEF;">
	
	<div id="previewArea" style="display:none; border: 1px solid #cccccc;"></div> 
	
	<div id="testWrap" ondblclick="recorte.submit();">

		<!-- <img src="" alt="test image" id="testImage" /> -->
		<img src="troca##arq##" id="testImage"/>
	</div>

	

	<div id="results">
	<p>

	<form name="recorte" method="post" action="index.php?action=MSup_RecortarImagemChancelaOperador&salvo=ok">
    <input type="hidden" name="idoper" value="troca##idoper##">
    <input type="hidden" name="validade" value="troca##validade##">
				<p>
					<!--label for="x1">x1:</label-->
					<input type="hidden" name="tx" id="x1" />
				</p>
				<p>
					<!--label for="y1">y1:</label-->
					<input type="hidden" name="ty" id="y1" />
				</p>
				<p>
					<!--label for="x2">x2:</label-->
					<input type="hidden" name="x2" id="x2" />
				</p>
				<p>
					<!--label for="y2">y2:</label-->
					<input type="hidden" name="y2" id="y2" />
				</p>
				<p>
					<!--label for="width">width:</label-->
					<input type="hidden" name="width" id="width" />
				</p>
				<p>
					<!--label for="height">height</label-->
					<input type="hidden" name="height" id="height" />
				</p>
			</div>
		</form>

	<!-- <input type=submit value=ok> -->
	<div class="barraCinza" style="">
											<table width="100%" border="0" cellpadding="0" cellspacing="0">
												<tr>
													<td width="100%">
													</td>
													<td style="padding-right:10px;">
														<img id="Salvar Recorte" class="hand mT4 right" style="margin-right: 5px;" src="img/salvar.jpg" width="36" height="24" onmouseover="trocaImg(this.id,'salvar_02.jpg')" onmouseout="trocaImg(this.id,'salvar.jpg')" title="Salvar Recorte" onclick="recorte.submit();"/>
													</td>
													<form name="formCancelar" method="POST" action="index.php?action=MSup_CadastrarChancelaOperador">
													<td style="padding-right:10px;">
														<img id="Cancelar" class="hand mT4 right" style="margin-right: 5px;" src="img/cancelar.jpg" width="36" height="24" onmouseover="trocaImg(this.id,'cancelar_02.jpg')" onmouseout="trocaImg(this.id,'cancelar.jpg')" title="Cancelar Recorte" onclick="formCancelar.submit();"/>
													</td>
													</form>
												</tr>
											</table>
											
										</div>
	

</body>
</html>